//
//  TextViewController.m
//  TestDemo
//
//  Created by zhangwenqiao on 2018/11/29.
//  Copyright © 2018年 zhangwenqiao. All rights reserved.
//

#import "TextViewController.h"
#import "WYNetworking.h"
#import <MJExtension.h>
#import "CommodityModel.h"
#import "GoodModel.h"
#import <AFNetworking.h>
#import "RequeTool.h"


@interface TextViewController ()
{
    CommodityModel *commodityModel;
    GoodModel *goodModel;
    
}


//@property (nonatomic, strong) GoodModel *goodModel;
@end

@implementation TextViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (IBAction)btnAction:(id)sender {
    //网络AF多层封装  2002  body有参
    [self planOne];
}

- (IBAction)btnActionTwo:(id)sender {
    //AF无封装  6002  body无参
    [self planTwo];
}

- (IBAction)btnactionThree:(id)sender {
    //AF无封装 10086 body有参
    [self planThree];
}

- (IBAction)btnActionFour:(id)sender {
    //网络方案 6002 body无参
    [self planFour];
}

- (IBAction)btnActionFive:(id)sender {
    //网络方案 6002 body无參
    [self planFive];
}
- (IBAction)btnActionSix:(id)sender {
    //老的拼接模式 6002 body无参
    [self planSix];
    
}

- (IBAction)btnActionSeven:(id)sender {
    //
    [self planSeven];
}

- (IBAction)btnActionNeight:(id)sender {
    //使用方案6对body有参数进行试验 2002
    [self planNeight];
}

#pragma mark --方案1 网络框架对AF进行进一步封装--
- (void)planOne {
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    NSMutableDictionary *dicHeader = [NSMutableDictionary dictionary];
    [dicHeader setValue:[NSString stringWithFormat:@"web"] forKey:@"plateForm"];
    [dicHeader setValue:[NSString stringWithFormat:@"1.0.0"] forKey:@"version"];
    [dicHeader setValue:[NSString stringWithFormat:@""] forKey:@"token"];
    [dicHeader setValue:[NSString stringWithFormat:@"2018-09-20 13:12:11"] forKey:@"requestTime"];
    [dicHeader setValue:[NSString stringWithFormat:@"application/json"] forKey:@"contentType"];
    [dicHeader setValue:[NSString stringWithFormat:@"RSA"] forKey:@"encryp"];
    [dicHeader setValue:[NSString stringWithFormat:@"2002"] forKey:@"action"];  //首页
    //    [dicHeader setValue:[NSString stringWithFormat:@"6002"] forKey:@"action"];  //周榜
    NSMutableDictionary *dicBody = [NSMutableDictionary dictionary];
    [dicBody setValue:[NSString stringWithFormat:@"%d", 1] forKey:@"page"];
    [dicBody setValue:[NSString stringWithFormat:@"%d", 10] forKey:@"size"];
    [dicBody setValue:[NSString stringWithFormat:@"%d", 1] forKey:@"rankingFlag"];
    [dic setValue:dicHeader forKey:@"header"];
    [dic setValue:dicBody forKey:@"body"];
    
    NSString *url = [NSString stringWithFormat:@"http://47.98.243.228:8081/app/v1"];
    [[WYNetworking sharedWYNetworking] POST:url parameters:dic success:^(id  _Nonnull responseObject) {
        NSLog(@"请求成功");
        NSLog(@"%@", responseObject);
        NSError *err;
        NSDictionary *dicC = [NSJSONSerialization JSONObjectWithData:responseObject
                                                             options:NSJSONReadingMutableContainers
                                                               error:&err];
        NSLog(@"%@", dicC);
        self->commodityModel = [CommodityModel mj_objectWithKeyValues:responseObject];
        NSLog(@"%ld", (long)self->commodityModel.totalCount);
        NSDictionary *dic = [NSDictionary mj_objectWithKeyValues:responseObject];
        NSLog(@"数据源字典 %@", dic);
        NSMutableArray *array = dic[@"list"];
        NSLog(@"数据源数组 %@", array);
        self->goodModel = [GoodModel mj_objectWithKeyValues:array[0]];
        NSLog(@"商品模型数据 %@", self->goodModel.productName);
    } failure:^(NSError * _Nonnull error) {
        NSLog(@"请求失败");
    }];
}

#pragma mark --方案2 AF无封装--
- (void)planTwo {
    NSString *str = [NSString stringWithFormat:@"http://47.98.243.228:8081/app/v1"];
    NSDictionary *dic = [self parameterDicAction:6002 BodyDic:nil];
    NSLog(@"参数字典dic--%@", dic);
    // 请求数据
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    [manager.requestSerializer setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain", @"multipart/form-data", @"application/json", @"text/html", @"image/jpeg", @"image/png", @"application/octet-stream", @"text/json", @"application/x-www-form-urlencoded", nil];
    //    manager.requestSerializer = [AFJSONRequestSerializer serializer];
    //    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    manager.requestSerializer.timeoutInterval = 10;
    [manager POST:str parameters:dic progress:^(NSProgress * _Nonnull uploadProgress) {
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSLog(@"%@", responseObject);
        NSLog(@"Post-----链接成功");
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"Post-----链接失败%@", error);
    }];
    
    [manager GET:str parameters:dic progress:^(NSProgress * _Nonnull downloadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        
        NSLog(@"%@", responseObject);
        NSLog(@"Get-----链接成功");
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"Get-----链接失败%@", error);
    }];
}

#pragma mark --方案3 AF无封装 192.168.1.125:8080 本地服务器设置--
- (void)planThree {
    NSString *url = [NSString stringWithFormat:@"http://192.168.1.125:8080/test/get"];
    
    NSMutableDictionary *dicBody = [NSMutableDictionary dictionary];
    [dicBody setValue:[NSString stringWithFormat:@"tom"] forKey:@"userName"];
    [dicBody setValue:[NSString stringWithFormat:@"password"] forKey:@"password"];
    [dicBody setValue:[NSString stringWithFormat:@"%d", 110] forKey:@"tel"];
    NSDictionary *dic = [self parameterDicAction:10086 BodyDic:dicBody];
    
    // 请求数据
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain", @"multipart/form-data", @"application/json", @"text/html", @"image/jpeg", @"image/png", @"application/octet-stream", @"text/json", nil];
    //    manager.requestSerializer = [AFJSONRequestSerializer serializer];
    //    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    manager.requestSerializer.timeoutInterval = 10;
    [manager POST:url parameters:dic progress:^(NSProgress * _Nonnull uploadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSError *err;
        NSDictionary *dicC = [NSJSONSerialization JSONObjectWithData:responseObject
                                                             options:NSJSONReadingMutableContainers
                                                               error:&err];
        NSLog(@"%@", dicC);
        NSLog(@"Post-----链接成功");
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"Post-----链接失败%@", error);
    }];
    
    [manager GET:url parameters:dic progress:^(NSProgress * _Nonnull downloadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSError *err;
        NSDictionary *dicC = [NSJSONSerialization JSONObjectWithData:responseObject
                                                             options:NSJSONReadingMutableContainers
                                                               error:&err];
        NSLog(@"%@", dicC);
        NSLog(@"Get-----链接成功");
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"Get-----链接失败%@", error);
    }];
}

#pragma mark --方案4 网络方案--
- (void)planFour {
    NSDictionary *dic = [self parameterDicAction:6002 BodyDic:nil];
    NSString *url = [NSString stringWithFormat:@"http://47.98.243.228:8081/app/v1"];
    
    NSString *strParameters = [NSString stringWithFormat:@"request=%@", [self dictionryTransformString:dic.copy]];
    
    NSMutableURLRequest *formRequest = [[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:url parameters:strParameters error:nil];
    [formRequest setValue:@"application/x-www-form-urlencoded; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    AFJSONResponseSerializer* responseSerializer = [AFJSONResponseSerializer serializer];
    [responseSerializer setAcceptableContentTypes:[NSSet setWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",@"text/plain",nil]];
    manager.responseSerializer= responseSerializer;
    
    NSLog(@"formRequest打印请求--%@", formRequest);
    NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:formRequest uploadProgress:^(NSProgress * _Nonnull uploadProgress) {
        
    } downloadProgress:^(NSProgress * _Nonnull downloadProgress) {
        
    } completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error) {
        if(error) {
            NSLog(@"Error: %@", error);
            return;
        }
        NSLog(@"网络方案--%@ %@", response, responseObject);
    }];
    [dataTask resume];
}

#pragma mark --方案5 网络方案AF改变 --
- (void)planFive {
    NSDictionary *dic = [self parameterDicAction:6002 BodyDic:nil];
    NSString *url = [NSString stringWithFormat:@"http://47.98.243.228:8081/app/v1"];
    NSDictionary *dicc = @{@"request":dic};
    
    [RequeTool post:url andData:dicc andCallback:^(id  _Nonnull JSON) {
        NSLog(@"%@", JSON);
    }];
}

#pragma mark --方案6 网络老方案 --
- (void)planSix {
    NSURL *url=[[NSURL alloc]initWithString:@"http://47.98.243.228:8081/app/v1"];
    NSDictionary *dic = [self parameterDicAction:6002 BodyDic:nil];
    NSString *strParameters = [NSString stringWithFormat:@"request=%@", [self dictionryTransformString:dic.copy]];
    
    NSMutableData *postBody=[NSMutableData data];
//    [postBody appendData:[@"date=2016-01-11&time=04:46&location=LOCATION35&name=NAME&a1=1&a2=2&a3=2&a3_remark=a3_remark&a4=1&a5=2&a6=2&a7=1&a8=a8&a9=a9&password=musesurvey&activity_type=KA&product_name1=sdg&product_name2=dg" dataUsingEncoding:NSUTF8StringEncoding]];
    [postBody appendData:[strParameters dataUsingEncoding:NSUTF8StringEncoding]];
    NSMutableURLRequest *request=[[NSMutableURLRequest alloc]initWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:20.0f];
    [request setHTTPMethod: @"POST"];
    [request setValue: @"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBody:postBody];
    
    NSError *error = nil;
    
    NSHTTPURLResponse* urlResponse = nil;
    //旧逻辑--------
//    NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
//    NSString *result = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
//    NSLog(@"结果：%@",result);
    
    //嵌入Request
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    AFJSONResponseSerializer* responseSerializer = [AFJSONResponseSerializer serializer];
    [responseSerializer setAcceptableContentTypes:[NSSet setWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",@"text/plain",nil]];
    manager.responseSerializer= responseSerializer;
    NSURLSessionDataTask *task1 = [manager dataTaskWithRequest:request uploadProgress:^(NSProgress * _Nonnull uploadProgress) {
        
    } downloadProgress:^(NSProgress * _Nonnull downloadProgress) {
        
    } completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error) {
        if(error) {
            NSLog(@"Error: %@", error);
            return;
        }
        NSLog(@"网络方案--%@", response);
        NSLog(@"请求得到数据--%@", responseObject);
    }];
    [task1 resume];
    
    //数据展示----
    NSURLSession *session = [NSURLSession sharedSession];
    NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
        NSLog(@"结果：%@", data);
        NSString *result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
        NSLog(@"结果：%@",result);
    }];
    [task resume];
}

#pragma mark --方案7 网络方案AF改变 --
- (void)planSeven {
    NSString *urlString = [NSString stringWithFormat:@"http://47.98.243.228:8081/app/v1"];
    NSMutableDictionary *parameters = [NSMutableDictionary dictionary];
    NSMutableDictionary *dicHeader = [NSMutableDictionary dictionary];
    [dicHeader setValue:[NSString stringWithFormat:@"web"] forKey:@"plateForm"];
    [dicHeader setValue:[NSString stringWithFormat:@"1.0.0"] forKey:@"version"];
    [dicHeader setValue:[NSString stringWithFormat:@""] forKey:@"token"];
    [dicHeader setValue:[NSString stringWithFormat:@"2018-09-20 13:12:11"] forKey:@"requestTime"];
    [dicHeader setValue:[NSString stringWithFormat:@"application/json"] forKey:@"contentType"];
    [dicHeader setValue:[NSString stringWithFormat:@"RSA"] forKey:@"encryp"];
    [dicHeader setValue:[NSString stringWithFormat:@"2002"] forKey:@"action"];
    
    NSMutableDictionary *dicBody = [NSMutableDictionary dictionary];
    [dicBody setValue:[NSString stringWithFormat:@"%d", 1] forKey:@"page"];
    [dicBody setValue:[NSString stringWithFormat:@"%d", 10] forKey:@"size"];
    [dicBody setValue:[NSString stringWithFormat:@"%d", 1] forKey:@"rankingFlag"];
    
    [parameters setValue:dicHeader forKey:@"header"];
    [parameters setValue:dicBody forKey:@"body"];
    
    NSDictionary *diccc = @{@"request":parameters};
    
    // 初始化Request
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:15.0];
    // http method
    [request setHTTPMethod:@"POST"];
    // http header
    [request addValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    // http body
    NSMutableString *paraString = [NSMutableString string];
    for (NSString *key in [diccc allKeys]) {
        [paraString appendFormat:@"&;%@=%@", key, diccc[key]];
    }
    [paraString deleteCharactersInRange:NSMakeRange(0, 1)]; // 删除多余的&;号
    
    [request setHTTPBody:[paraString dataUsingEncoding:NSUTF8StringEncoding]];
    // 初始化AFManager
    AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration: [NSURLSessionConfiguration defaultSessionConfiguration]];
    AFJSONResponseSerializer *serializer = [AFJSONResponseSerializer serializer];
    serializer.acceptableContentTypes = [NSSet setWithObjects:
                                         @"text/plain",
                                         @"application/json",
                                         @"text/html", nil];
    manager.responseSerializer = serializer;
    NSLog(@"paraString-HTTPBody--%@", paraString);
    NSLog(@"paraString-HTTPBody--%@", [paraString dataUsingEncoding:NSUTF8StringEncoding]);
    // 构建请求任务
    NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) {
        if (error) {
            // 请求失败
            NSLog(@"Request failed with reason '%@'", [error localizedDescription]);
        } else {
            // 请求成功
            NSLog(@"Request success with responseObject - /n '%@'", responseObject);
        }
    }];
    // 发起请求
    [dataTask resume];
}

#pragma mark --方案8 对有body参数进行试验--
- (void)planNeight {
    NSURL *url=[[NSURL alloc]initWithString:@"http://47.98.243.228:8081/app/v1"];
    NSMutableDictionary *dicBody = [NSMutableDictionary dictionary];
//    [dicBody setValue:[NSString stringWithFormat:@"%d", 1] forKey:@"page"];
//    [dicBody setValue:[NSString stringWithFormat:@"%d", 10] forKey:@"size"];
//    [dicBody setValue:[NSString stringWithFormat:@"%d", 1] forKey:@"rankingFlag"];
    [dicBody setValue:[NSString stringWithFormat:@"%ld", 13523532791] forKey:@"mobile"];
    [dicBody setValue:[NSString stringWithFormat:@"%d", 123] forKey:@"password"];
    
    NSDictionary *diccc = @{@"page":@1, @"size":@10, @"rankingFlag":@1};
    
    NSDictionary *dic = [self parameterDicAction:1001 BodyDic:dicBody.copy];
    NSString *strParameters = [NSString stringWithFormat:@"request=%@", [self dictionryTransformString:dic.copy]];
    NSMutableData *postBody=[NSMutableData data];
    
    //    [postBody appendData:[@"date=2016-01-11&time=04:46&location=LOCATION35&name=NAME&a1=1&a2=2&a3=2&a3_remark=a3_remark&a4=1&a5=2&a6=2&a7=1&a8=a8&a9=a9&password=musesurvey&activity_type=KA&product_name1=sdg&product_name2=dg" dataUsingEncoding:NSUTF8StringEncoding]];
    
    [postBody appendData:[strParameters dataUsingEncoding:NSUTF8StringEncoding]];
    NSMutableURLRequest *request=[[NSMutableURLRequest alloc]initWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:20.0f];
    [request setHTTPMethod: @"POST"];
    [request setValue: @"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBody:postBody];
    
    NSError *error = nil;
    
    NSHTTPURLResponse* urlResponse = nil;
    //旧逻辑--------
    //    NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];
    //    NSString *result = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
    //    NSLog(@"结果：%@",result);
    
    //嵌入Request
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    AFJSONResponseSerializer* responseSerializer = [AFJSONResponseSerializer serializer];
    [responseSerializer setAcceptableContentTypes:[NSSet setWithObjects:@"application/json",@"text/json",@"text/javascript",@"text/html",@"text/plain",nil]];
    manager.responseSerializer= responseSerializer;
    NSURLSessionDataTask *task1 = [manager dataTaskWithRequest:request uploadProgress:^(NSProgress * _Nonnull uploadProgress) {
        
    } downloadProgress:^(NSProgress * _Nonnull downloadProgress) {
        
    } completionHandler:^(NSURLResponse * _Nonnull response, id  _Nullable responseObject, NSError * _Nullable error) {
        if(error) {
            NSLog(@"Error: %@", error);
            return;
        }
        NSLog(@"网络方案--%@", response);
        NSLog(@"请求得到数据--%@", responseObject);
    }];
    [task1 resume];
    
    //数据展示----
    NSURLSession *session = [NSURLSession sharedSession];
    NSURLSessionDataTask *task = [session dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
        NSLog(@"结果：%@", data);
        NSString *result = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
        NSLog(@"结果：%@",result);
    }];
    [task resume];
}

#pragma mark--请求参数封装--
- (NSDictionary *)parameterDicAction:(NSInteger)action BodyDic:(NSMutableDictionary *)bodyDic{
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    
    NSMutableDictionary *dicHeader = [NSMutableDictionary dictionary];
    [dicHeader setValue:[NSString stringWithFormat:@"web"] forKey:@"plateForm"];
    [dicHeader setValue:[NSString stringWithFormat:@"1.0.0"] forKey:@"version"];
    [dicHeader setValue:[NSString stringWithFormat:@""] forKey:@"token"];
    [dicHeader setValue:[NSString stringWithFormat:@"2018-09-20 13:12:11"] forKey:@"requestTime"];
    [dicHeader setValue:[NSString stringWithFormat:@"application/json"] forKey:@"contentType"];
    [dicHeader setValue:[NSString stringWithFormat:@"RSA"] forKey:@"encryp"];
    [dicHeader setValue:[NSString stringWithFormat:@"%ld", action] forKey:@"action"];
    
    NSMutableDictionary *dicBody = [NSMutableDictionary dictionary];
    if (bodyDic == nil) {
        
    }else {
        dicBody = bodyDic;
    }
    
    [dic setValue:dicHeader forKey:@"header"];
    [dic setValue:dicBody forKey:@"body"];
    
    NSDictionary *dicc = [NSDictionary dictionaryWithDictionary:dic];
    return dicc;
}

#pragma mark-字典转字符串-
- (NSString *)dictionryTransformString:(NSMutableDictionary *)dic {
    NSError *error;
    NSLog(@"dic--%@", dic);
    NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic
                                                       options:NSJSONWritingPrettyPrinted
                                                         error:&error];
    NSLog(@"jsonData--%@", jsonData);
    NSString *str = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
    NSLog(@"str--%@", str);
    return str;
}






//小程序接口尝试
- (void)requstXiaoChengXu {
    NSString *str = [NSString stringWithFormat:@"http://192.168.1.141:12060/api/bargain/intoBargainDetail"];
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    [dic setValue:[NSString stringWithFormat:@"29"] forKey:@"surroundId"];
    [dic setValue:[NSString stringWithFormat:@"1"] forKey:@"isShare"];
    [dic setValue:[NSString stringWithFormat:@""] forKey:@"token"];
    
    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain", @"multipart/form-data", @"application/json", @"text/html", @"image/jpeg", @"image/png", @"application/octet-stream", @"text/json", nil];
    
    manager.requestSerializer = [AFJSONRequestSerializer serializer];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    manager.requestSerializer.timeoutInterval = 10;
    [manager POST:str parameters:dic progress:^(NSProgress * _Nonnull uploadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSError *err;
        NSDictionary *dicC = [NSJSONSerialization JSONObjectWithData:responseObject
                                                             options:NSJSONReadingMutableContainers
                                                               error:&err];
        NSLog(@"%@", dicC);
        NSLog(@"Post-----链接成功");
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"Post-----链接失败%@", error);
    }];
    
    [manager GET:str parameters:dic progress:^(NSProgress * _Nonnull downloadProgress) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
        NSError *err;
        NSDictionary *dicC = [NSJSONSerialization JSONObjectWithData:responseObject
                                                             options:NSJSONReadingMutableContainers
                                                               error:&err];
        NSLog(@"%@", dicC);
        NSLog(@"Get-----链接成功");
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
        NSLog(@"Get-----链接失败%@", error);
    }];
}


@end
